package io.lkt.modules.sys.service.impl;

import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;

import io.lkt.modules.sys.dao.BBusinessDocumentDao;
import io.lkt.modules.sys.entity.BBusinessDocumentEntity;
import io.lkt.modules.sys.service.BBusinessDocumentService;


@Service("bBusinessDocumentService")
public class BBusinessDocumentServiceImpl extends ServiceImpl<BBusinessDocumentDao, BBusinessDocumentEntity> implements BBusinessDocumentService {

    @Override
    @DataSource("master")
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BBusinessDocumentEntity> page = this.page(
                new Query<BBusinessDocumentEntity>().getPage(params),
                new QueryWrapper<BBusinessDocumentEntity>()
        );

        return new PageUtils(page);
    }

    @DataSource("master")
    public BBusinessDocumentEntity getById(Serializable id)
    {
        return (BBusinessDocumentEntity)((BBusinessDocumentDao)this.baseMapper).selectById(id);
    }

    @DataSource("master")
    public boolean save(BBusinessDocumentEntity entity)
    {
        return retBool(Integer.valueOf(((BBusinessDocumentDao)this.baseMapper).insert(entity)));
    }

    @DataSource("master")
    public boolean updateById(BBusinessDocumentEntity entity)
    {
        return retBool(Integer.valueOf(((BBusinessDocumentDao)this.baseMapper).updateById(entity)));
    }

}
